<?php echo $head ?>
<div class="right-content">
    <div class="clearfix">
        <form action="/admin/jurisdiction/save_apply" method="post" class="form-horizontal form ajaxfrom we7-form"
              role="form" id="form-user">
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">用户名</label>
                <div class="col-sm-10 col-lg-9 col-xs-12">
                    <input id="" name="username" type="text" class="form-control" value="<?php echo $username ?>"
                           disabled="disabled">
                </div>
            </div>
            <input type="hidden" name="id" value="<?php echo $id ?>">
            <!--            上级权限设置-->
            <div class="form-group module-permission">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">权限设置</label>
                <div class="col-sm-10 col-lg-10 col-xs-12">
                    <?php foreach ($jur_1 as $k => $v) { ?>
                        <div class="col-sm-4 dropdown">
                            <span class="checkbox">
                            <input id="check-child-<?php echo $v['id'] ?>" type="checkbox"
                                   value="<?php echo $v['id'] ?>" name="jur_1[]"
                                   onclick="ch_click(<?php echo $v['id'] ?>)">
                            <label for="check-child-<?php echo $v['id'] ?>" data-toggle="tooltip" data-original-title=""
                                   title=""><?php echo $v['name'] ?></label>
                        </span>
                        </div>
                    <?php } ?>
                </div>
            </div>

            <!--            子级权限设置-->
            <div class="form-group module-permission">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">次级权限设置</label>
                <div class="col-sm-10 col-lg-10 col-xs-12">
                    <?php foreach ($jur_2 as $k => $v) { ?>
                        <div class="col-sm-10 col-lg-10 col-xs-12 plugin-name jur_2_<?php echo $v['data']['id'] ?>"
                             style="display: none"><?php echo $v['data']['name'] ?></div>
                        <?php foreach ($v['list'] as $key => $val) { ?>
                            <div class="col-sm-4 dropdown jur_2_<?php echo $v['data']['id'] ?>" style="display: none">
                                <span class="checkbox">
                                    <input id="check-child-<?php echo $val['id'] ?>" type="checkbox"
                                           value="<?php echo $val['id'] ?>"
                                           class="checkbox_jur_2_<?php echo $v['data']['id'] ?>" name="jur_2[]">
                                    <label for="check-child-<?php echo $val['id'] ?>" data-toggle="tooltip"
                                           data-original-title=""
                                           title=""><?php echo $val['name'] ?></label>
                                </span>
                            </div>

                        <?php } ?>
                    <?php } ?>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-md-offset-2 col-lg-offset-1 col-xs-12 col-sm-10 col-md-10 col-lg-11">
                    <input type="submit" class="btn btn-primary span3" name="submit" value="提交">
                </div>
            </div>
        </form>

        <script>
            function ch_click(j_cliss) {
                if ($("#check-child-" + j_cliss).get(0).checked) {
                    $('.checkbox_jur_2_' + j_cliss).prop("checked", true);
                    $('.jur_2_' + j_cliss).css("display", "block");
                    //选中
                } else {
                    //取消选中
                    $('.checkbox_jur_2_' + j_cliss).prop("checked", false);
                    $('.jur_2_' + j_cliss).css("display", "none");
                }
            }


            window.onload = function () {
                <?php
                if($Jurisdiction_1 != false){
                foreach($Jurisdiction_1 as $k=>$v)
                {   ?>
                $('#check-child-<?php echo $v?>').prop("checked", true);
                $('.jur_2_<?php echo $v?>').css("display", "block");
                <?php
                }
                }

                if(!empty($Jurisdiction_2)){
                foreach($Jurisdiction_2 as $k=>$v){
                ?>
                $('#check-child-<?php echo $v?>').prop("checked", true);

                <?php
                }
                }

                ?>

            }


        </script>
